package com.ctvit.sjk.knowledge.paragraph.pojo.vo;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ctvit.sjk.knowledge.paragraph.pojo.domain.TabParagraph;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.time.LocalDateTime;

/**
 * 分段查询VO
 *
 * @author heyingcheng
 * @date 2025/3/28
 */
@Getter
@Setter
@ToString
public class ParagraphGetVO {

    private String id;
    @JsonProperty("dataset_id")
    private String datasetId;
    @JsonProperty("document_id")
    private String documentId;
    private String title;
    private String content;
    @JsonProperty("char_length")
    private Integer charLength;
    private String status;
    @JsonProperty("is_active")
    private Boolean isActive;
    @JsonProperty("hit_num")
    private Integer hitNum;
    @JsonProperty("status_meta")
    private JSONObject statusMeta;
    @JsonProperty("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @JsonProperty("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;

    public ParagraphGetVO(TabParagraph entity) {
        this.id = entity.getParagraphId();
        this.datasetId = entity.getDatasetId();
        this.documentId = entity.getDocumentId();
        this.title = entity.getParagraphTitle();
        this.content = entity.getParagraphContent();
        this.charLength = entity.getCharLength();
        this.status = entity.getParagraphStatus();
        this.isActive = entity.getActiveFlag();
        this.hitNum = entity.getHitNum();
        this.statusMeta = JSON.parseObject(entity.getStatusMetadata());
        this.createTime = entity.getCreateTime();
        this.updateTime = entity.getUpdateTime();
    }

}
